// components/avatar/avatar.js
Component({
  properties: {
    src: { //头像图片路径
      type: String,
      value: ''
    },
    radius: { //头像圆角
      type: [String,Number],
      value: 5
    },
    size: { //头像尺寸
      type: [String, Number],
      value: 48
    },
    bgColor: { //头像背景颜色
      type: String,
      value: '#f2f2f2'
    },
    color: { //头像文本颜色
      type: String,
      value: '#333'
    },
    text: { //文本头像文本,优先级低于src,有图片头像时无效
      type: String,
      value: ''
    },
    textSize: { //文本字体大小
      type: [String, Number],
      value: 16
    },
    dot: { //点的颜色
      type: String,
      value: '#ff3d3d'
    },
    value: { //点的值
      type: [String,Number],
      value: '',
      observer(newVal){
        if(newVal > 99){
          this.setData({
            newValue:'99+'
          })
        }else{
          this.setData({
            newValue:newVal
          })
        }
      }
    },
    showDot: { //是否显示点信息
      type: Boolean,
      value: false
    }
  },
  data: {
    newValue:0
  },
  lifetimes: {
    attached: function () {
     
    }
  },
  methods: {
    
  }
})
